package com.example.pagenavigation.slice;

import com.example.pagenavigation.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Text;

public class SecondAbilitySlice extends AbilitySlice {
    @Override
    public void onStart(Intent intent) {
        super.onStart(intent);
        super.setUIContent(ResourceTable.Layout_ability_second);
        // 获取文本组件对象
        Text text = (Text)findComponentById(ResourceTable.Id_text_second);
        // 设置文本组件的单击监听器
        text.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                // 结束当前的Ability
                terminateAbility();
            }
        });

    }

    @Override
    public void onActive() {
        super.onActive();
    }

    @Override
    public void onForeground(Intent intent) {
        super.onForeground(intent);
    }
}
